export default {
  namespaced:true,
  state:() => ({
    adress:JSON.parse(uni.getStorageSync('adress') || '{}'),
    token:''
  }),
  mutations:{
    setAdress(state,adress){
      state.adress = adress
      // 存储本地
      this.commit('user/saveDate')
    },
    saveDate(state){
      uni.setStorageSync('adress',JSON.stringify(state.adress))
    }
  },
  getters:{
    fullAdress({adress}){
      if(JSON.stringify(adress) === '{}') return ''
      return `${adress.provinceName}${adress.cityName}${adress.countyName}${adress.detailInfo}`
    }
  }
}